package forwardKinematics;

/**
 * 
 * @author Alex Paxton
 *
 */
import java.util.*;
import java.io.*;
import java.nio.file.*;
/*import java.nio.channels.*;
import java.nio.channels.FileChannel;
import java.nio.channels.spi.AbstractInterruptibleChannel;
import static java.nio.file.StandardOpenOption.*;*/
public class LogEngine 
{
	private PrintWriter outputStream;
	private Scanner inputStream;
	private Path logfile;
	
	public LogEngine()
	{
		//Calendar.YEAR + "-" + Calendar.MONTH + "-" + Calendar.DAY_OF_MONTH + "-" + Calendar.HOUR_OF_DAY + "-" + Calendar.MINUTE + "-" + Calendar.SECOND + ".log"
		Calendar rightNow = Calendar.getInstance();
		String s = "G1-log-" + rightNow.getTimeInMillis() + ".log";
		logfile = FileSystems.getDefault().getPath(s, "");//.getDefault().getPath("logs", "test.txt");
		System.out.println(logfile);
		//update("lol");
		System.out.println(Calendar.YEAR);
		System.out.println(Calendar.MONTH);
		System.out.println(Calendar.DAY_OF_MONTH);
		System.out.println(Calendar.HOUR_OF_DAY);
		//System.out.println(Calendar.MINUTE);
		System.out.println(Calendar.SECOND);
		System.out.println(Calendar.getInstance());
	}
	
	public void update(String s)
	{
		byte data[] = s.getBytes();
		
		try (OutputStream out = new BufferedOutputStream(
		                 Files.newOutputStream(logfile, StandardOpenOption.CREATE, StandardOpenOption.APPEND))) {
		    /*...*/
		    out.write(data, 0, data.length);
		} catch (IOException x) {
		    System.err.println(x);
		}
	}
}
